define(["jquery","bbcare","bld/app/classify/classifyList.ui"],function($,$bb,$ui) {
    var servers = {};
    var URL = $bb.baseUrl("blood");

    /**
     * 获取方案分类
     */
    servers.ajaxQueryAllSchemeClass = function(callback) {
        $bb.ajax({
            url: URL + "schemeClass/queryAllSchemeClass",
            success: function(data) {
                if (data.success) {
                    callback(data.data);
                } else {
                    $bb.toastShow(data.msg ? data.msg : "获取方案分类出错！");
                }
            }
        });
    }
    /**
     * 查询所有疾病信息
     */
    servers.ajaxDiseaseAll = function(callback) {
        $bb.ajax({
            url: URL + "disease/queryDiseaseAll",
            success: function(data) {
                if (data.success) {
                    callback(data.data);
                } else {
                    $bb.toastShow(data.msg ? data.msg : "查询所有疾病信息出错！");
                }
            }
        });
    }
    /**
     * 添加方案分类
     */
    servers.ajaxAddSchemeClass = function(params,callback) {
        $bb.ajax({
            url: URL + "schemeClass/addSchemeClass",
            data: JSON.stringify({
                data: params
            }),
            success: function(data) {
                if (data.success) {
                    callback(data.data);
                } else {
                    $bb.toastShow(data.msg ? data.msg : "添加方案分类出错！");
                }
            }
        });
    }
    /**
     * 根据classId获取class信息
     */
    servers.getClassByClassId = function(schemeClasses,classId){
        for (var i = 0; i < schemeClasses.length; i++) {
            if( schemeClasses[i].id == classId ) 
            return schemeClasses[i];
        }
    }
    /**
     * 删除方案分类
     */
    servers.ajaxDeleteSchemeClass = function(params,callback) {
        $bb.ajax({
            url: URL + "schemeClass/deleteSchemeClass",
            data: JSON.stringify({
                data: params
            }),
            success: function(data) {
                if (data.success) {
                    callback(data.data);
                } else {
                    $bb.toastShow(data.msg ? data.msg : "删除方案分类出错！");
                }
            }
        });
    }

    return servers;
});